package cc.autoapi.pucong.auto.flow.core.root.selfenum;

import com.fasterxml.jackson.annotation.JsonCreator;

// 0post 1get 2delete 3put
public enum ApiTypeEnum implements CommonEnum<Integer> {

    POST(0),
    GET(1),
    DELETE(2),
    PUT(3);

    private Integer key;

    ApiTypeEnum(Integer key) {
        this.key = key;
    }

    @Override
    public String getName() {
        return this.name();
    }

    @Override
    public Integer getValue() {
        return key;
    }

    @JsonCreator
    public static ApiTypeEnum getItemByValue(Integer value) {
        ApiTypeEnum[] itemArr = ApiTypeEnum.values();
        if (value != null) {
            for (ApiTypeEnum item : itemArr) {
                if (value.equals(item.getValue())) {
                    return item;
                }
            }
        }
        return null;
    }
}
